/******************************************************************************
 * Copyright (C) 2017 Chengdu Dlhd information industry co. LTD.
 * All Rights Reserved.
 * 本软件为成都顶联互动信息产业有限公司开发研制。未经本公司正式书面同意，其他任何个人、团体不得使用、复制、修改或发布本软件.
 *****************************************************************************/
package net.dgg.dggcloud.service.jrcrm.service.cms;

import net.dgg.dggcloud.core.idwork.KeyWorker;
import net.dgg.dggcloud.service.common.base.service.BaseService;
import net.dgg.dggcloud.service.entity.user.User;
import net.dgg.dggcloud.service.jrcrm.entity.customer.Contact;
import net.dgg.dggcloud.service.jrcrm.entity.customer.ShowNumberRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName: ShowNumberRecordService
 * @Description:
 * @Author 汤宏
 * @date 2017/12/5 11:20
 */
@Service
public class ShowNumberRecordService extends BaseService {

    @Autowired
    private KeyWorker keyWorker;
    public void saveShowNumberRecord(Long customerId,String tableName,Long tableId,String number,User loger){
        ShowNumberRecord showNumberRecord = new ShowNumberRecord();
        showNumberRecord.setId(keyWorker.nextId());
        showNumberRecord.setCustomerId(customerId);
        showNumberRecord.setTableId(tableId);
        showNumberRecord.setTableName(tableName);
        showNumberRecord.setNumber(number);
        showNumberRecord.setCreateUser(loger);
        super.repository.save(showNumberRecord);
    }

    public Contact showNumber(Long contactId){
       return super.repository.get(Contact.class,contactId);
    }
}
